package ${package.Entity};

import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotation.*;
<#list table.importPackages as pkg>
import ${pkg};
</#list>

<#list table.fields as field>
<#if (field.name == "create_time")||(field.name =="update_time")||(field.name =="created_time") ||(field.name =="updated_time")>
import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
</#if>
</#list>

<#if entityLombokModel>
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import io.swagger.annotations.ApiModel;
</#if>


/**
 * ${table.comment!} 实体类
 *
 * @author ${author}
 * @since ${date}
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("${table.name}")
@ApiModel(value="${entity}对象")
public class ${entity} extends Model<${entity}> {

<#-- ----------  BEGIN 字段循环遍历  ---------->
<#list table.fields as field>
    <#if field.comment!?length gt 0>
        <#if swagger2>
    @ApiModelProperty(value = "${field.comment}")
        <#else>
    /**
     * ${field.comment}
     */
        </#if>
    </#if>
    <#if field.name == "id" >
    @TableId(value = "id")
    </#if>
    <#if (field.name == "create_time")||(field.name =="created_time")>
    @TableField(value = "${field.name}",fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")// 后台传数据到前台
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") //前台传数据到后台
    </#if>
    <#if (field.name =="update_time")||(field.name =="updated_time")>
    @TableField(value = "${field.name}",fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")// 后台传数据到前台
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") //前台传数据到后台
    </#if>
    private ${field.propertyType} ${field.propertyName};

</#list>
<#------------  END 字段循环遍历  ---------->

    @Override
    protected Serializable pkVal() {
        return this.id;
    }
}
